package com.mingxi.backend.controller;

import com.mingxi.backend.common.Result;
import com.mingxi.backend.pojo.dto.SelectCourseDto;
import com.mingxi.backend.service.SelectCourseService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/v1/selectCourse")
public class SelectCourseController {

    @Resource
    private SelectCourseService selectCourseService;

    @GetMapping("/list")
    public Result selectCourseList(@RequestParam String username, @RequestParam int pageSize,@RequestParam int pageNumber) {
        return selectCourseService.getAvailableCourse(username,pageSize,pageNumber);
    }

    @PostMapping("/select")
    public Result selectCourse(@RequestBody SelectCourseDto dto) {
        selectCourseService.selectCourse(dto);
        return Result.success("选课成功！");
    }

    @PostMapping("/add")
    public Result addSelectCourse(@RequestBody SelectCourseDto dto) {
        return null;
    }

    @DeleteMapping("/delete")
    public Result deleteSelectCourse(@RequestBody SelectCourseDto dto) {
        return null;
    }
}
